map = function(){
	if(this.location.length){
		print(this.location);
		var locations = this.location.split(",");
		for(var i in locations){
			print(locations[i] +" , " +i);
			emit(locations[i],{count:1});
		}
	}
};

reduce = function(key,emits){
	print("****************************In Reduce Function **************************")
	total = 0;
	for(var i in emits){
		print(key + " , "+ i)
		total += emits[i].count;
	}
	print(total)
	return {key : {"count" : total}};
};

reduce = function(key,values){
	print("****************************In Reduce Function ************************** "+key)
	var totalJobCount = 0
	values.forEach(function(value){
		totalJobCount +=value.count;
	});
	return totalJobCount;
};



var map = function(){
	print(this.location);
	if(this.location.length){
		print(this.location);
		var locations = this.location.split(",");
		for(var i in locations){
			print(locations[i] +" , " +i);
			var skills = this.skills.split(",");
			for(var j in skills){
			print(skills[j]);
				emit({location : locations[i] , skill:skills[j]} ,{count : 1});
			}
		}
	}
};

var reduce = function(key,values){
	print("****************************In Reduce Function ************************** "+key)
	var skillCount = 0
	values.forEach(function(value){
		skillCount +=value.count;
	});
	return {key : skillCount};
};


